package cn.itsource.basic.controller;

import cn.itsource.basic.service.IVerifyCodeService;
import cn.itsource.basic.util.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * 前台注册 - 验证码
 *      图形验证码
 *      手机验证码
 */
@RestController
@RequestMapping("/verifyCode")
public class VerifyCodeController {

    @Autowired
    private IVerifyCodeService verifyCodeService;

    /** 获取图形验证码 */
    @GetMapping("/image/{key}")
    private AjaxResult getImageCode(@PathVariable("key") String key){
        return verifyCodeService.getImageCode(key);
    }

    /** 获取手机验证码 */
    @PostMapping("/smsCode")
    private AjaxResult getSmsCode(@RequestBody Map<String,String> map){
        return verifyCodeService.getSmsCode(map);
    }

    /** 前台注册：获取手机验证码 */
    @PostMapping("/binderSmsCode")
    private AjaxResult getBinderSmsCode(@RequestBody Map<String,String> map){
        return verifyCodeService.getBinderSmsCode(map);
    }
}
